ARG BUILD_ENV=stage
ARG debug

FROM node:16-alpine as builder
ARG debug
ARG BUILD_ENV
ENV BUILD_ENV=${BUILD_ENV}

WORKDIR /app

RUN npm i -g @quasar/cli

COPY ./package.json .

RUN npm install

COPY . .

RUN quasar build --mode pwa ${debug}


FROM nginx:1.23.1-alpine
ARG BUILD_ENV
ENV BUILD_ENV=${BUILD_ENV}

WORKDIR /www

COPY --from=builder /app/dist/pwa .

COPY ./compose/${BUILD_ENV}/app.conf /etc/nginx/conf.d/default.conf

EXPOSE 80